Last active
February 19, 2018 19:02
-
-
Save dodok1/4352500 to your computer and use it in GitHub Desktop.
prototype for confluence content parsing # Get Confluence XML Schema
# Put confluence.dtd and xhtml-*.ent to your working directory
# Try attached groovy script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.xml.XmlUtil | |
def content=new File(args[0]).getText() | |
def slurper = new XmlSlurper(false,false) | |
def prefix = """<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE ac:confluence SYSTEM "confluence.dtd"> | |
<ac:confluence xmlns:ac="http://www.atlassian.com/schema/confluence/4/ac/" xmlns:ri="http://www.atlassian.com/schema/confluence/4/ri/" xmlns="http://www.atlassian.com/schema/confluence/4/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.atlassian.com/schema/confluence/4/ac/ confluence.xsd"> | |
""" | |
def suffix = "</ac:confluence>" | |
def xml = slurper.parseText(prefix+content+suffix) | |
println XmlUtil.serialize(xml) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment