Basic XML/DTD design/structure validity.

I would like some clarification on valid XML structure - is it valid to have an XML element content both CDATA & other elements? I noticed that by using the keyword ANY in my DTD, that the SAX parser that I'm using seems to accept the following -
<firstElement att="1">
Some character values.
<secondElement att="2"/>
</firstElement>
However, is this a poor design choice? I have made several attempts to read up on DTD/XML structure and have not found anything which explains whether that structure/approach is valid or not.
Many thanks!
~ RomT

Yes, you can do that. It's called "mixed content" in the markup biz. And as you suspect, it's not the greatest design choice. No doubt there are uses for it -- for example if you have a text string and you want to mark off pieces of it as being bold or italic -- but you should probably try to avoid it if possible.

Similar Messages

  • XML structure validation by javascript

    Hi All,
    I’m trying to find solution for XML structure validation on opening the indesign document.
    Is this possible by javascript.
    by
    hasvi

    Or you could go directly to the source.
    http://help.sap.com/saphelp_nw70/helpdata/en/c4/e1343e8c7f6329e10000000a114084/frameset.htm
    Regards,
    Henrique.

  • Help: DTD only partially validating XML file

    Following are a small XML file I wrote and its accompagning DTD:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE userSettings SYSTEM "userSettings.dtd">
    <userSettings>
    <pref name = "language" type = "string" value="EN" />
    <pref name = "defaultfont" type = "string" value = "Arial" />
    <pref name = "defaultPageWidth" type = "number" value = "595" />
    <pref name = "defaultPageHeight" type = "number" value = "841" />
    </userSettings>DTD:
    <!ELEMENT userSettings (pref+)>
    <!ELEMENT pref EMPTY>
    <!ATTLIST pref
              name     CDATA          #REQUIRED
              type     (string | number)     #REQUIRED
              value     CDATA          #REQUIRED
    >So the attribute "type" of the element "pref" can only be either a number or a string. But if i write "sting" for example, the DTD does not issue an error. I know the DTD is working since changing the root element for instance does generate errors.
    Anyone has a clue to why is my DTD only partially validating my XML file?

    Hello!
    This is a simple example in Sun jdk 1.4.2.
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.SAXParser;
    import java.io.File;
    public class DTDValidator extends DefaultHandler {
        public static void main(String[] args) {
            try {
                SAXParserFactory factory = SAXParserFactory.newInstance();
                factory.setValidating(true);
                SAXParser parser = factory.newSAXParser();
                DTDValidator myHandler = new DTDValidator();
                File file = new File("my.xml");
                parser.parse(file, myHandler);
            } catch (Exception e) {
                e.printStackTrace();
        public void error(SAXParseException e) throws SAXException {
            super.error(e);
            System.out.println(e.getMessage());
        public void fatalError(SAXParseException e) throws SAXException {
            super.fatalError(e);
            System.out.println(e.getMessage());
    }Result:
    Value "sting" is not one of the enumerated values for this attribute.

  • DTD and XSD Validation for xml file

    hi kindly reply to this mail guru'ssss
    i am facing a problem in parising a xml file against dtd and xsd.
    i have the dtd which contains only enitities that can be present in the xml file and the xsd file for validation against elements and attribute.
    when DTD is present then it is throwing errors like the elements should be declared.
    when i take out the doctype line and validate against schema its throwing the error that particular entity is not found or declared.
      public Vector validateSchema(String SchemaUrl, String XmlDocumentUrl)  
          SAXParser parser =new SAXParser();
         try{
             //parser.setNamespaceAware (true);     
             //parser.s
             parser.setFeature("http://xml.org/sax/features/validation",true);
             parser.setFeature("http://apache.org/xml/features/validation/schema",true);
             parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
            // parser.setProperty("http://xml.org/sax/properties/declaration-handler", new DTDHandl());
             parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",SchemaUrl);
            // parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
            // System.out.println(parser.getDTDHandler());
            // UnparsedCache cache = new UnparsedCache();
           //  parser.setDTDHandler(cache);
             InputSource inputSource =new InputSource(new java.io.FileInputStream(new java.io.File(XmlDocumentUrl)));
           //  parser.setDTDHandler(new myDTDHandler());
             //parser.setEntityResolver(new CustomResolver());
         //  parser.setContentHandler(this);
             Validator handler=new Validator();
             parser.setErrorHandler(handler); 
             parser.parse(inputSource);
             if(handler.validationError==true)
               System.out.println("XML Document is not valid");
             else                  
               System.out.println("XML Document is valid");
             for(int i=0;i<ErrorLines.size();i++){
                 System.out.println(ErrorLines.elementAt(i));
       }catch(java.io.IOException ioe){  
         System.out.println("IOException"+ioe.getMessage());   
       }catch (SAXParseException e) {
         System.out.println("SAXParseException "+e.getMessage());   
      }catch (SAXException e) {
         System.out.println("SAXException"+e.getMessage());   
         return ErrorLines;
    what could be soln to this.

    Hi
    Venky_Ferrari.
    Based on your description, your case related to XMLXSD, SO I will move your thread to
    Data Platform Development > XML, System.Xml, MSXML and XmlLite      
    forum for better support.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Reg: consistency check in recordset structure validation

    Hi all,
    I am doing FCC to FCC scenario, i am getting this error. Help me out, it is very urgent for me.
    Sender Adapter v2723 for Party '', Service 'bs_text2text':
    Configured at 2007-08-21 08:00:49 UTC
    History:
    - 2007-08-21 09:29:06 UTC: Retry interval started. Length: 2.000 s
    - 2007-08-21 09:29:06 UTC: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR consistency check in recordset structure validation (line no. 87: missing structure(s) in last recordset
    - 2007-08-21 09:29:06 UTC: Processing started
    - 2007-08-21 09:29:04 UTC: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR consistency check in recordset structure validation (line no. 87: missing structure(s) in last recordset
    - 2007-08-21 09:29:04 UTC: Processing started
    Regards,
    Ajay.

    Hi Ajay,
    Problem with the file content conversion parameters you specified in the sender file adapter. 
    Do let us know your DT structure and FCC parameters specified in adapter.
    Regards,
    Sumit

  • ERROR consistency check in  recordset structure validation

    Hi,
    I have a file that has the format below. The file is managed with the below content conversion parameters. However, it's not working and the error message that i get is "Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR consistency check in recordset structure validation (line no. 7: missing structure(s) in last recordset". Any idea, what when wrong? Thanks.
    Message Type defined:
    FileHeader            (occurrence = 1)
      ARPostingRecord    (occurrence = 1 to unbounded)
        RecordHeader       (occurrence = 1 to unbounded)
        RecordDetail          (occurrence = 1 to unbounded)
    Source file looks like this:
    01 Field1 Field2...Field-n  
    H  Field1 Field2...Field-n  
    L  Field1 Field2...Field-n  
    L  Field1 Field2...Field-n  
    H  Field1 Field2...Field-n  
    L  Field1 Field2...Field-n  
    L  Field1 Field2...Field-n  
    where:
    01 is the keyfieldvalue for FileHeader
    H is the keyfieldvalue for RecordHeader
    L is the keyfieldvalue for RecordDetail
    Specified parameters:
    FileHeader.fieldSeparator
    FileHeader.endSeparator
    FileHeader.fieldNames
    FileHeader.keyFieldValue
    RecordHeader.fieldSeparator
    RecordHeader.endSeparator
    RecordHeader.fieldNames
    RecordHeader.keyFieldValue
    RecordHeader.missingLastFields
    RecordHeader.keepIncompleteFields
    RecordDetail.fieldSeparator
    RecordDetail.endSeparator
    RecordDetail.fieldNames
    RecordDetail.keyFieldValue
    RecordDetail.missingLastFields
    RecordDetail.keepIncompleteFields
    ignoreRecordsetName
    Recordset Name:
    ARPostingRecord
    Recordset Structure:
    FileHeader,1,RecordHeader,1000000,RecordDetail,1000000

    >ERROR consistency check in recordset structure validation (line no. 7: missing structure(s) in last recordset". Any idea, what when wrong?
    When you are not sure about number of records for RecordHeader and RecordDetail, Please specify wildchar character. Dont give max numbers.  The errors says expecting the specified number for recordset and  since it is missing gives errror.

  • Handling XMLs with unknown structures.

    Hello Experts,
       I have to build a generic interface RFC -> PI -> JMS, which will receive XML structure as a string in import parameter of RFC.
    Then I need to convert this string to XML, add digital signatures and then output the signed payload to JMS Queues.
    I have been looking at SDN posts and found that XSLT can be used to convert string to XML. But the catch is I am not aware of the XML structures that will be sent in as a string. So how can I handle these unknown structures? Or what should be the structure of the target Interface for XSLT mapping??
    Any inputs on this will be of great help.
    Kind Regards,
    PIQueries_2010

    If you dont want the target structure to be validated XSLT/java mapping is the way to go as pointed out by MIchal.
    If you use the new feature, I believe it will validate the target structure.
    @Michal,
    Just a quick clarification, when we use java/xslt mapping to skip target message validation in PI 7.1 is it mandatory to have the operation name exactly same as Service Interface name? I recently ran into an issue where the Service interface name was different from the operation name and the Java mapping was giving an error saying "Unable to validate root element" or something similar (Ofcourse, the content was binary file and hence java mapping to skip the target structure validation).
    Thanks
    Jai

  • XML DTD - Table or Object

    Dear all,
    Do you have any guideline or good example to model db tables for nested Structure of XML DTD?
    How can I create table or objects for following XML DTD?
    <!ELEMENT book (title, author, Chapter*)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT author (#PCDATA)>
    <!ELEMENT Chapter (content, body?)>
    <!ELEMTNS content (#PCDATA)>
    <!ELEMENT body (#PCDATA)>
    null

    i hope that this exampel of nested table will help you
    create or replace type test1_obj as object (num1 number(4),num2 number(4));
    create type test1_obj_teble as table of test1_obj;
    create table test101(csec number(4),tnum number(4),ditals test1_obj_teble) nested table ditals store as test1_ditals;
    /

  • Topic Design/Structure = Speed of updating content in project

    1. Yes, we do incorporate screen captures in our topics, and
    I have streamlined as much as I can, stripping out all duplicates
    and linking to the source.
    2. I do realize that by use of the pop-up images, which I use
    a lot, it does impact the speed simply by virtue of the image size.
    3. MY question is this: I was hired to maintain a system that
    already exists and have taught myself a lot of streamlining
    features but am sure there are others I'm not aware of. I was just
    wondering if maybe there was a better design structure I could
    apply to improve the efficiency of the topics. Here is our current
    structure:
    1 Main project under which all other projects (CHM) are
    linked as Merged Topics.
    300+ Topics - each one creating a separate CHM that is then
    merged into the main project
    Some of these individual topics are quite large (we have 1
    topic per screen/feature). I have broken out as much as I can into
    common topics and link to those rather than repeating information;
    but even with that, I still have some huge ones such as the one I'm
    working today.
    It is taking like 1 minute at times from clicking "Insert
    hyperlink" till I get the dialog to select the bookmark and several
    minutes just for the topic to open or compile.
    I've come across terms such as "Page" "Topic" "Book" "Pane"
    etc, and was just wondering if maybe we need to tweak our
    underlying structure to improve in this area. Any suggestions?
    Thanks a heap!

    Welcome to our community
    Sounds like RoboHelp would certainly fit the bill for what you are seeking. Basically it works as follows:
    You maintain all the content on your local PC.
    You then Generate a Web Based output such as WebHelp, FlashHelp or AIR Help (Web Based).
    Once the output has been created, you publish it to the Web location.
    So perhaps you add a few pages and change some others.
    You make those changes in your local copy of RoboHelp and Generate the Web Based output again.
    You then publish the output to the Web location to populate the updates.
    The first time you publish output ALL the content has to be copied across. But at that time, RoboHelp makes a list of what files were copied.
    Subsequent publish operations only copy the files that need to be copied. So the first time through it may take a few minutes to copy all the content. But subsequent publish cycles should take just a brief while. Often, just a few seconds.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcererStone Blog
    RoboHelp eBooks

  • XML to ABAP Structure transformation

    Hi SAP,
       Can anyone tell how to transform from XML to ABAP structure. The ABAP structure i'm getting in runtime.
    Please do the needful.
    Thanks in advance
    Vinod.

    using XSLT or ST you can do that check this thread
    https://forums.sdn.sap.com/click.jspa?searchID=5585367&messageID=1661688
    and also search ABAP forum for more code samples

  • XML/DTD to be converted to XSD

    Hi ,
    I have requirement that i am getting xml file as input which i need to read through inbound file adaptor and write another delimited file.
    The challenge i am facing is i am not able to transmit xml file to xsd file trough native format builder.
    Can you please provide solution for generating xsd file for xml files.
    Note: There is format type called "DTD to be converted to XSD" under native format builder wizard.Is it like that first we need to convert xml to DTD then XSD?
    If so can you please geve me small example of demonstrating these steps,because whenever i try with sample dtd file i am getting error: "No element found in DTD Specified"
    My sample file "note.dtd" is <?xml version="1.0"?>
    <!DOCTYPE note [
    <!ELEMENT note (to,from,heading,body)>
    <!ELEMENT to (#PCDATA)>
    <!ELEMENT from (#PCDATA)>
    <!ELEMENT heading (#PCDATA)>
    <!ELEMENT body (#PCDATA)>
    ]>
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend</body>
    </note>
    Thanks in advance.

    U can use Document Editor tool to convert XML file to DTD. The steps are
    File-->Import-->Chose DTD from XML file option and give ur file as input-->It will convert ur XML file into ECS file-->File-->Export-->select XML DTD option and this will convert the ECS file to DTD file
    U can use BPEL to convert DTD file to XSD. The steps are
    Tools-->Convert DTD to XSD and give ur DTD file as Input-->It will convert ur DTD file to XSD file
    I hope it will help.
    Thanks,
    Saravana
    Edited by: user10635261 on Nov 20, 2008 9:41 AM

  • Bad performance when deleting report column in webi(with "Design – Structure only")

    Hi all,
    One of our customer has recently upgraded from BO XI to BO4.1. In the new BO 4.1, they encountered a bad performance issue when they were deleting a column in Webi(using "Design – Structure only" mode).
    With “Design – Structure only" mode,  it took webi about 10 seconds to complete after the customer right-clicked a report column and clicked the "delete".  The customer said that they only need to wait for less than 1 second when they did the same in BO XI old version.
    The new BO version used is 4.1SP02, installed in Windows Server 2008 R2. (Server with 32 core CPU, 32G memory)
    This bad performance happened in both Webi web and Rich Client. (in Webi Rich Client, the performance is a little bit better. The 'delete column' action takes about 8 seconds to complete).
    Do anyone know how to tune this performance in webi?  Thank you.
    Besides, it seems that each time we are making change in the webi report structure in IE or Rich Client, webi need to interact with Server site to upload the changes. Is there any option to change this behavior?  Say, do not upload change to Server for when 'deleting report column', only trigger the upload after a set of actions(e.g. trigger when click the "Save" button).
    Thank you.
    Regards,
    Eton.

    Hi all,
    Could anyone help me on this?  Thanks!
    What customer concerns now is that when they did the same 'column editing' action in BO XI R2 for the same report, they did not need to wait.  And they need to wait for at least 7-8 second in the BO 4.1SP02 environment for this action to complete.(data already purged, in structure-only mode)
    One more information about the webi report being editing is: there are many sheets in the report(about 6~10 sheets in one report). Customer don't want to separate these sheet into different reports  as it will increase the effort of their end users to locate similar report sheets.
    Regards,
    Eton.

  • Web Service XML Input Arguments Schema Validation

    I'm new to web services, but we are currently implementing a number of Web Services that all take as arguments a single parameter which is an XMLBean, which has been generated by a XML Schema.
    What I find surprising is that when I submit a SOAP message to the Web Service (through the http Web Service Tester inside eclipse), I can send any valid XML without getting a SOAP fault. Is there a way on the Web Service that I want the XML submitted to be validated against the XML Schema for that parameter?
    Bit surprised I have to implement my own input argument validation, and there doesn't appear to be a standard way to do this. I must be missing soemthing surely? Why else would the Schema be in the WSDL?
    Cheers
    John

    I'm new to web services, but we are currently
    implementing a number of Web Services that all take
    as arguments a single parameter which is an XMLBean,
    which has been generated by a XML Schema.
    What I find surprising is that when I submit a SOAP
    message to the Web Service (through the http Web
    Service Tester inside eclipse), I can send any valid
    XML without getting a SOAP fault. Is there a way on
    the Web Service that I want the XML submitted to be
    validated against the XML Schema for that parameter?
    Bit surprised I have to implement my own input
    argument validation, and there doesn't appear to be a
    standard way to do this. I must be missing soemthing
    surely? Why else would the Schema be in the WSDL?
    Cheers
    JohnHas anyone found an answer to this, we have the same issue?

  • Generate database schema in XML from database structure

    hi
    I want to generate the entire database schema in XML from database structure. (Same feature is provided by Altova XMLSpy).
    It would be great if there was some API that does the process of parsing the database structure and generating the XML automatically. A similiar feature is provided by Apache DdlUtils' API, but a stable version is not yet available...
    Please help!
    Thanks in advance.

    Nikhil,
    There is a wealth of information available on the Internet regarding the XML capabilities of the Oracle database.
    Have you done an Internet search for "SQL XML Oracle"?
    Good Luck,
    Avi.

  • Best design structure for 4710's

    We are implementing 4710's in our core network..
    what could be the best design structure from a simplicity point
    one interface vlan for for vips---connected front end to the core..and backend for servers (routed mode)
    should you have more than one interface vlan for servers and or clients?
    at which point would u need multi context.......besides an Admin context
    should you put a management interface on each context?

    We are implementing 4710's in our core network..
    --what could be the best design structure from a simplicity point
    Design would vary based on specific requirements. To connect it to a specific layer on the network (core/agg) you would have to check the traffic flow to decide what suits you best.
    In terms of ACE design, if source IP visibility is not a requirement, One-arm mode with Source NAT provides the ability for non load balanced traffic to bypass the ACE. If it is a requirement you can use PBRs but that complicates things a little because you have to now manage the routers for changes on the ACE. With routed mode, the design is simple and servers point to the ACE as their default gateway. Need to weigh the pros and cons of each of the options based on the specific requirements.
    --one interface vlan for for vips---connected front end to the core..and backend for servers (routed mode)
    Yes - for routed mode that would be the way to do it. In this case, in addition to load balancing, the ACE routes non-loadbalanced traffic to/from the servers.
    should you have more than one interface vlan for servers and or clients?
    - Depends in your subnets. If you have separate subnets for your web/app/db servers then it is a good idea to have different subnets. Also, you may want to think about separate contexts if you want complete isolation between the layers.
    --at which point would u need multi context.......besides an Admin context
    As far as possible, try to keep the Admin context only for administration. Make a separate context(s) for load balancing and manage the resources to it.
    --should you put a management interface on each context?
    Yes - that would give you the ability to have different users manage only their contexts.
    Hope that helps .

Maybe you are looking for

  • Installation of Oracle 11g 32 bit Client on Windows 7 (32 bit) laptop.

    Hi, I just got a new Laptop with Windows 7 (32 bit) operating system. Has any one successfully installed Oracle 11g client on in Windows 7 environment and if so what are the steps involved. In the past I have never had any trouble installing an Oracl

  • Change mail to: account

    When I click on a link in an HTML page that has a mail to: link, a new Mail message is opened, but it's not my preferred account (I have several). If I choose an account in Preferences>Composing to send new messages, then Mail always uses that accoun

  • Need to customize the text displayed while sending payslip as pdf in mails

    Gurus ,    monthly we will run a report which will send the payslip as pdf to the employees . Now we need to edit the text that is getting displayed in the mail while we attaching the payslip as pdf and send . how to achieve this

  • SIGNING IN TO THE JDC - java.lang.OutOfMemoryError

    Today when I try and sign in I keep getting: Exception java.lang.OutOfMemoryError: requested 164 bytes. I found a work-around and someone suggested I post a link to it here (I posted it in the Discuss the JDC Web Site forum) so here it is: http://for

  • Variable for fiscal year

    Hello all, I have a requirement to determine the current year in BPS. I made a variable and wrote a function module. The code I have is: DATA: DATE LIKE SY-DATUM,               CURRYEAR TYPE C,                  CHARSEL TYPE UPC_YS_CHARSEL. CLEAR: CHA