Adding Root Element

Hi
I have an existing structure in XML
<article>
<text>
</text>
</article>
Here the element article is holding the content and is associated with the text frame.
I would like to modify the structure to
<Root>
<article>
<text>
</text>
</article>
</Root>
But still the article element should only be holding the content and shud be associated with text frame is it possible to do that either manually or through scripting in ID CS3
Thanks

Hi Priya,
assume you have an Xml File imported
<?xml version="1.0" encoding="UTF-8"?>
<article>
<text>myText</text>
</article>
and you have dragged <article> from the InDesign xml structure onto a textframe on the layout.
Now, run this script to apply the Root-Tag to your article.
myDoc = app.activeDocument;
myArticleXmlElement = myDoc.xmlElements.item(0);
myArticleXmlTag = myDoc.xmlTags.item("article");
myTextXmlElement = myArticleXmlElement.xmlElements.item("text");
try{
myRootXmlTag = myDoc.xmlTags.add("Root");
catch(e){
myRootXmlTag = myDoc.xmlTags.item("Root");
myArticleXmlElement.markupTag = myRootXmlTag;
myNewArticleXmlElement = myDoc.xmlElements.item(0).xmlElements.add(myArticleXmlTag);
myTextXmlElement.move(LocationOptions.AT_BEGINNING, myNewArticleXmlElement);
Hope this is what you were looking for. You can do all of this manuallly as well. In fact this is how I began before writing the script.
Just for curiosity, what is that for ? And can you not just import an Xml that already contains the root element ?
Stefan

Similar Messages

  • Root element added in existing mapping PI 7.1

    Hi Experts,
    I got existing mapping with around 500 fields, the source structure is external defination, they added the root element to existing xsd, when i try to import the external definition into the mapping it is giving following error.
    Function model undefined (FUNCMODEL_UNDEF)
    MESSAGE ID: com.sap.aii.mappingtool.mf.mapping.rb_Mapping.FUNCMODEL_UNDEF
    Parameter AMappingTool has the invalid value null
    Is anyone faced this problem before, i am working on PI 7.1, but when i create the new mapping then i can successfully imported the external definition into mapping, but how can i get my existing mapping into new mapping??
    Thanks

    > Is anyone faced this problem before, i am working on PI 7.1,
    Yes, indeed. Report this to SAP.

  • Dynamic Programming: Adding Transparent Container to Root Element

    Hi,
    I simply am adding a Transparent Container to the Root Element dynamically and I am getting the error "The ASSERT condition was violated".
    Does anyone have an idea what the problem is.
    Below is my VERY MUCH simplified code:
    method WDDOMODIFYVIEW .
      DATA:
        LR_ROOT TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
        LR_TCONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER,
        LR_FLOW_DATA TYPE REF TO CL_WD_FLOW_DATA.
      LR_ROOT ?= VIEW->GET_ROOT_ELEMENT( ).
      LR_TCONTAINER = CL_WD_TRANSPARENT_CONTAINER=>NEW_TRANSPARENT_CONTAINER(
        id = 'TCONTAINER_01' ).
      LR_FLOW_DATA = CL_WD_FLOW_DATA=>NEW_FLOW_DATA( LR_TCONTAINER ).
      LR_TCONTAINER->SET_LAYOUT_DATA( LR_FLOW_DATA ).
      LR_ROOT->ADD_CHILD( LR_TCONTAINER ).
    endmethod.

    Found the answer on this link:
    Creating dynamic tranparent container

  • Adding namespace prefix to the XMLa root element

    I am facing a problem in our application. I am assigning an XML content to a XSD variable. While assignment operation is performed the prefix of the XML root element alone is getting replaced with default namespace, though the source XML has the prefix. Please let me know if any patch or workaround is available to address this issue.
    Thanks!

    Hi All,
    we are also facing the same issue, Please provide the solution if anyone knows. We are also using the SOA Suite 11g Version.

  • Root element required error in syndication

    Hi,
    We have added few new fields into the main table. Now accordingly we need to update the Oubound map to include these new fields. I have created a new XSD file having these new fields. But when I try to use this in syndicator to update, it throws me an error back saying "Root element required". I checked in SDN but couldnt find enough clues.
    Any pointers will be highly appreciated.
    Regards,
    Ponraj M

    Hello,
    There are few possible root causes to this error appearing in MDM Syndicator:
    1. This error indicates that the XSD is not valid as there is no declaration of the root element.
    If you try to validate this XSD in XMLspy you will receive a similar error.
    2. The XSD declares the root element but it does not appear in the XML.
    If you validate the XML against the XSD in XMLspy you will receive a similar error.
    3. An illegal character in the XSD root element declaration makes it impossible for Syndicator to detect it.
    Please check these possible causes.
    Best regards,
    Hedda Cohen.

  • B1if Error: Parsing an empty source. Root element expected!

    Dear experts,
    i have created a scenario from SAP PI to SAP B1if.
    Under On package i have created multiple scenarios and all were working succesfully.
    But i added another scenario now and tested its giving the below error.
    infact now , when i am testing the scenarios (which were working succesfully before), all of them are giving the same error as below:
    SAP B1iP detected an error:
    Emitted HTTP-Code
    500 - Internal Server Error
    Internal Reason
    Parsing an empty source. Root element expected!
    Full Internal Error Message
    com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE001 Nested exception: com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE001 Nested exception: com.sap.b1i.utilities.UtilException: UTE001 Nested exception: javax.xml.transform.TransformerConfigurationException: Could not load stylesheet. java.io.IOException: Parsing an empty source. Root element expected!
    i am givng the correct input message with root nodes etc but still i am getting the error.
    Please help!!
    Thanks.

    hi,
    you want to convert yor receivee structure or sender??
    see these links about FCC to see how they do it.
    File Receiver with Content Conversion
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    Type of separatos
    http://help.sap.com/saphelp_nw04/helpdata/en/05/7fdf3d0eb8af5ee10000000a114084/frameset.htm
    Troubleshooting the File Adapter
    /people/shabarish.vijayakumar/blog/2007/07/26/troubleshooting-the-file-adapter-last-updated-on-02-july10
    Converting File Content in a Sender Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    Converting File Content in the Receiver Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    Thanks
    Rodrigo
    PD: Reward points if useful
    Edited by: Rodrigo Pertierra on May 14, 2008 12:11 PM

  • 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

    Error : 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute specified on the root element tag.
    Hi,
    I get this error when i include some namespaces in my ResourceDictionary to specify a Style for a custom control.
    Can anyone help me?
    Thx
    Stardusty

    Hi,
    That's the whole point. I don't want to use x:TypeArguments on a ResourceDictionary but the compiler says it needs it.
    And i don't know why.
    This code give no error:
    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespaceystem;assembly=mscorlib">  
    </ResourceDictionary>
    And by adding 3 namespaces it gives that weard error:
    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:MyTime.View.Controls"
    xmlns:converters="clr-namespace:MyTime.View.Converters"
    xmlns:validationrules="clr-namespace:MyTime.View.ValidationRules"
    xmlns:sys="clr-namespaceystem;assembly=mscorlib">  
    </ResourceDictionary>

  • XML-20108: (Fatal Error) Start of root element expected. - jdev 11.1.2.3

    Hello:
    I created a simple ADF Fusion Web app using HR schema based on Employees table.
    I am trying to get Contextual Events working and I did the following:
    Created two taskflows: TaskFlowA and TaskFlowB. TaskFlowA has a form based on employees and TaskFlowB has a table based on employees.
    Run the page and everything works.
    Now, in the property inspector based on the submit button, I added a contextual event to publish the event.
    Attempt to run the page again and I receive compile error:
    \WEB-INF\temp\adf\styles\cache\fusionFx-v2-1-desktop-pr245v-ltr-ie-7.0-cmp.css
    Error(1,1): <Line 1, Column 1>: XML-20108: (Fatal Error) Start of root element expected.
    Any ideas to prevent/fix this problem?
    Thanks much
    Edited by: 966952 on Apr 9, 2013 5:51 AM

    As a temporary solution you could add below lines in the xml file
    <?xml version="1.0" encoding="UTF-8" ?>
    <test>
    </test>
    See, the link for more info: http://adfhowto.blogspot.in/2011/05/utility-to-remove-once-and-for-all-rdf.html

  • PCO 2.1 Error : there are multiple root elements Line 6, position 2

    HI all,
    I am getting an error while adding Destination for Notification.
    On the Destination Tab, I am able to create MII System as Destination. And expanding the newly created Destination, i can see a child node 'Destination'. While clicking on this child node, i am getting an error as "there are multiple root elements Line 6, position 2"
    Can anybody please help.
    Regards
    Muzammil

    Hi,
    While configuring MII Server details, instead of IP address of MII server, we gave domain name and it started working.
    Regards
    Muzammil

  • Start of root element expected - error

    I attempt to extend the VO and get the Start of root element expected while opening server.xml file. This VO is based for an LOV and I need to modify the query to exclude some records. I already added the base page xml file as well as the LOV page xml.
    Any ideas?

    Looks like a corrupted file issue. Please transfer the file from instance again as ascii and try.
    --Shiv                                                                                                                                                                                                                       

  • Insert new tags after root element

    Hi,
    I'm trying to insert new tags immediately after the root element in a DOM tree. The data to be inserted is being passed to the program as a string parameter. I've used Dom4J to add the data as a new element immediatelty after the root. Problem is, I'm not able to extract the content as a String from the document object. Here's my sample code :
    String addStr = "<div class=\"test2\">Test Val1</div><div class=\"test2\">Test Val2</div>";
    SAXReader reader = new SAXReader();
    String xml = "<div class=\"discussionThread dt\"><div class=\"dt_subject\">2011 IS HERE!</div></div>";
    Document document = reader.read(new StringReader(xml));
    DefaultElement newElement = new DefaultElement("div");
    newElement.addAttribute("class", "test");
    newElement.add(new DefaultText(addStr));
    List content = document.getRootElement().content();
    if (content != null ) {
            content.add(0, newElement);
    }There are couple of issues with this approach.
    1. I'm not able to find a way to convert the Document object content to String. The only API reference is asXML() which converts the document to a xml and sends it back as String. As a result of this, it adds a <xml> tag at the top.Also,the content within the added String has been parsed and converted to &gt; , &lt;
    Here's the output
    <?xml version="1.0" encoding="UTF-8"?>
    <div class="discussionThread dt"><div class="test">&lt;div class="test2"&gt;Test Val1&lt;/div&gt;&lt;div class="test2"&gt;Test Val2&lt;/div&gt;</div><div class="dt_subject">2011 IS HERE!</div></div>Just wanted to know if there's a better way to do this. Any pointers will be highly appreciated.
    -Thanks

    from oracle documentation...
    Old and new values are available in both BEFORE and AFTER row triggers. A new column value can be assigned in a BEFORE row trigger, but not in an AFTER row trigger (because the triggering statement takes effect before an AFTER row trigger is fired). If a BEFORE row trigger changes the value of new.column, then an AFTER row trigger fired by the same statement sees the change assigned by the BEFORE row trigger.
    for more details read the documentation

  • Start of the root element expected.

    Hello Gurus,
    I moved all my project contents from one root directory to another, after seting up everything. It gives compile time error on adf-faces-config.xml and adf-faces-skins.xml.
    The error:
    XML-20108 - Start of the root element expected.
    I have no idea what could have originated this error and how to fix it. Can any one help me?
    Thank you.
    Ruchir

    I built the new project structure from scratch. i.e. created new application, then added a web project, then added all css file from old locations, then, created new xml documents and renamed it to adf-config-faces.xml and adf-faces-skins.xml and manually copied from these config xml documents from old location to newer one.
    And then at last, copied the .jspx page and when compiling that, control moves to adf-config-faces.xml file and gives the error.
    Thanks,
    Ruchir

  • The markup in the document preceding the root element must be well-formed

    Hi,
    Each time I add some library, something serious happens to my NetBeans5.5 and Tomcat 5.5.17. This time I added jsf-facelets.jar and now nothing is being deployed. I m getting following exception
    javax.servlet.ServletException: Error Parsing /Dept.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:202)
    Is there any special procedure to follow to add libraries?
    Plz help.

    Facelets is XHTML. XHTML is XML-HTML. XML require strict well-formness of the tags. I.e. every tag should be correctly nested and closed.
    I would say, read the Facelets Developer Documentation: http://www.google.com/search?q=facelets+developer+documentation

  • The root element is required in a well-formed document.

    While trying to parse the following xml file using jaxp.jar and xerces.jar I am getting the following exception
    org.xml.sax.SAXParseException: The root element is required in a well-formed document.
    at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1196)
    at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:570)
    at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.endOfInput(XMLDocumentScanner.java:790)
    at org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocumentScanner.java:418)
    at org.apache.xerces.validators.common.XMLValidator.sendEndOfInputNotifications(XMLValidator.java:694)
    at org.apache.xerces.readers.DefaultEntityHandler.changeReaders(DefaultEntityHandler.java:1026)
    at org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityReader.java:168)
    at org.apache.xerces.readers.AbstractCharReader.changeReaders(AbstractCharReader.java:150)
    at org.apache.xerces.readers.AbstractCharReader.lookingAtChar(AbstractCharReader.java:217)
    at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.dispatch(XMLDocumentScanner.java:686)
    at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
    at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
    at XMLConverter.parse(XMLConverter.java:65)
    at XMLConverter.parse(XMLConverter.java:116)
    at XMLConverter.main(XMLConverter.java:282)
    xml file
    <?xml version="1.0"?>
    <CustomerOrder>
    <Customer>
    <FirstName> Bob </FirstName>
    <LastName> Hustead </LastName>
    <CustId> abc.123 </CustId>
    </Customer>
    <OrderItems>
    <OrderItem>
    <Quantity> 1 </Quantity>
    <ProductCode> 48.GH605A </ProductCode>
    <Description> Pet Rock </Description>
    <Price> 19.99 </Price>
    </OrderItem>
    <OrderItem>
    <Quantity> 12 </Quantity>
    <ProductCode> 47.9906Z </ProductCode>
    <Description> Bazooka Bubble Gum </Description>
    <Price> 0.33 </Price>
    </OrderItem>
    <OrderItem>
    <Quantity> 2 </Quantity>
    <ProductCode> 47.7879H </ProductCode>
    <Description> Flourescent Orange Squirt Gun </Description>
    <Price> 2.50 </Price>
    </OrderItem>
    </OrderItems>
    </CustomerOrder>
    Can anybody please help me.
    Thanks in advance

    Hi There,
    I too am experiencing the same problem. I originally began with the problem described in
    http://forum.java.sun.com/thread.jsp?forum=34&thread=138862
    I removed the jaxp.jar and parser.jar from Tomcat's Lib folder and added the xerces.jar. This moved me on to the problem described in this thread.
    Here is my XML file:
    <?xml version="1.0"?>
    <training_seminar>
         <student>
              <id>0001</id>
              <name>Joe Jones</name>
              <email>[email protected]</email>
              <passport level="4 course">yes</passport>
         </student>
         <student>
              <id>0031</id>
              <name>Patrick Thompson</name>
              <email>[email protected]</email>
              <passport>no</passport>
         </student>
    </training_seminar>
    And here is my XSL:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              version="1.0">
    <xsl:template match="training_seminar">
    <HTML><BODY>
         <TABLE BORDER="1">
         <TR>
              <TH>Student ID</TH>
              <TH>Name</TH>
              <TH>E-Mail</TH>
              <TH>Passport</TH>
         </TR>
         <xsl:for-each select="student">
              <TR>
                   <TD> <xsl:value-of select="id"/></TD>
                   <TD> <xsl:value-of select="name"/> </TD>
                   <TD> <xsl:value-of select="email"/> </TD>
                   <TD> <xsl:value-of select="passport"/> </TD>
              </TR>
         </xsl:for-each>
         </TABLE>
    </BODY></HTML>
    </xsl:template>
    </xsl:stylesheet>
    And I guess while I am at it, my classpath:
    CLASSPATH=e:\java\jdk1.3.1\jre\lib\rt.jar;e:\jakarta-tomcat-3.2.3\lib\servlet.jar;E:\Dev Tools\xalan-j_2_1_0\bin\xerces.jar;E:\Dev Tools\xalan-j_2_1_0\bin\xalan
    .jar;E:\Dev Tools\xalan-j_2_1_0\bin\xsltc.jar;E:\Dev Tools\xalan-j_2_1_0\bin\xml
    .jar;.
    Any ideas is truly appreciated.
    Thanks,
    Gregg

  • JDOMException: root element required in a well-formed document

    Ok, my XML file looks something like this:
    <?xml version="1.0" ?>
    <this>
    <that></that>
    </this>
    ... and my Java code to build a JDOM object model from the XML file (Xerces-parsed) looks somethings like this:
    Document theDoc;
    SAXBuilder theBuilder;
    InputSource = theSource;
    theBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    theDoc = builder.build(theSource);
    Now, when I compile and run, I get a JDOMException that looks something like this:
    org.jdom.JDOMException: Error on line 1 of document : The root element is required in a well-formed document.
    What's up with that?

    (1) Thanks for taking the time. I'm not sure how I could make more than one root element. All I know is, in my XML file, the element tag that comes right after the <? xml version="1.0" ?> line has the same name as the very last tag in the file (with a "/" added before the name). There are no other elements in the file with that name, so I figure that makes it (ie. <this></this>) the root element of my document. N'est pas?
    (2) I have some more info since I originally posted:
    I added the following line:
    "System.err.println(e.getCause());"
    ... to the catch() area that throws the JDOMException - like follows:
    try {
    theCurrentDocument = builder.build( docFile ); // builder is an object created with <i>builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");</i>
    docType_CurrentDoc = theCurrentDocument.getDocType();
    root_CurrentDoc = theCurrentDocument.getRootElement();
    catch( org.jdom.JDOMException e ) {
    System.err.println(e); // Caused the original JDOMException from my first post
    System.err.println(e.getCause()); // Line I added since my first post
    The amended code above produced an extra line of output to the console:
    "java.security.AccessControlException: access denied (java.io.FilePermission \myfile.xml read)"
    Which I take to mean that I have to sign my applet. Is there any way around doing that? Because I don't want to if I don't have to.

Maybe you are looking for