Properties.storeToXML uses incorrect DTD

Please vote for bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6277868. This is a simple problem with the format of the DTD used by Java Properties. It makes them unreadable by most XML parsers. In particular, if you need to share properties between Java and .Net, this is a problem. I posted a workaround for C# that allows it to read these file. The workaround is to prevent the use of external documents by setting dom.XmlResolver = null;

Thanks for the PSA. Hmm... not sure how I feel about
cross-posts, but if the issue is occuring, Sun might
as well fix it.
- SaishYou're welcome.
According to the usual wisdom, this isn't really a cross-post. It's more like a cross-reference in that It contains a pointer to the other post. I posted it here as well since the vast majority of Properties users, rarely read the XML forum.

Similar Messages

  • Validating an XML document using external DTD?

    Hi,
    I want to validate an XML file using external DTD with SAX parser.
    How can I validate an XML file with external DTD.
    Thanks in Advance,
    Mahendra

    I dont think we can set a DTD file throug java while
    parsing an XML.I've done it with an XML schema though. Can you use that instead? For schemas you do something like:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setAttribute( "http://java.sun.com/xml/jaxp/properties/schemaSource",
                                       schemaUrl );where schemaUrl in this case would be something like file:///usr/local/whatever.xsd

  • Get the pc name with domain name and add it to my properties file using commands

    i want to get the pc name with domain name and add it to my properties file using powershell  .
    sid

    function Get-Environment{
    [environment]|Get-Member -Static -MemberType Properties |
    ForEach-Object{
    if($_.Name -ne 'StackTrace'){
    $v=[scriptblock]::Create("[environment]::$($_.Name)").Invoke()
    New-Object PsCustomObject -Property ([ordered]@{Name=$_.Name;Value=$v[0]})
    Get-Environment
    Get-Environment | Out-String | Out-File environment.txt
    ¯\_(ツ)_/¯

  • Use external DTD in 11g

    Hi,
    I try to parse an XML file within a CLOB column. In Oracle 9i and 10g the code work, but in 11 I get a lot of errors.
    First I got
    ORA-31020: Der Vorgang ist nicht zulässig, Ursache: For security reasons, ftp and http access over XDB repository is not allowed on server side (-31020)
    The XML file contains a reference to an external DTD, which is accessible per HTTP on a remote webserver.
    As I have understood, I have to register all my DTDs within the Oracle Database. I found
    dbms_xmlschema.registerURI()
    to do the job. This is very unpractical, because there are a lot of DTDs, which can be referenced by the XML-CLOBs. So I have to register all the DTDs manually.
    Normally the XML generator adds the matching DTD reference and so I can validate the XML with the parser without any knowledge about the type of the DTD.
    To figure out the problem I read a lot of documents on severyl websites. I have tried
    select HTTPURITYPE('http://mywebserver.domain/schema/mydtd-v1.0.dtd').getCLob() from dual;
    to load the DTD content. Surprise, surprise I got a lot of ACL errors. To solve that, I have added some network acls. At the moment the statement above
    returns my DTD within a CLOB now, so it seems, that I can load the external file from the remote webserver.
    Back to registerURI():
    dbms_xmlschema.registerURI(
          schemaURL => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          schemaDocUri => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          local => false);
    returns now (error messages in German)
    ORA-31011: XML-Parsing nicht erfolgreich
    ORA-19202: Fehler bei XML-Verarbeitung
    LPX-00247: Ungültige Dokument-Typ-Deklaration (DTD)
    Error at line 5
    aufgetreten
    ORA-06512: in "XDB.DBMS_XMLSCHEMA_INT", Zeile 20
    ORA-06512: in "XDB.DBMS_XMLSCHEMA", Zeile 199
    ORA-06512: in Zeile 12
    The same error occurs on
    dbms_xmlschema.registerschema(
          schemaURL => 'http://mywebserver.domain/schema/mydtd-v1.0.dtd',
          schemaDoc => HTTPURITYPE('http://mywebserver.domain/schema/mydtd-v1.0.dtd').getCLob()
    How I can get more information about the underlying error? I have tried to enable tracing for some XDB events, but in the udump directory
    exist only old files. I think, the DTD is correct, also the reference within the XML CLOB (because it works on the old database instances).
    It seems to be a security or character-set(?) issue.
    Any ideas?
    Thanks a lot
    Andre

    As I have understood, I have to register all my DTDs within the Oracle Database.
    Not exactly.
    DBMS_XMLSchema procedures deal with XML schemas, not DTDs.
    You can have Oracle resolve the DTD by loading it into the XML DB repository at the same uri referenced by the XML file.
    Or, if you don't actually need to use those DTDs to validate XML documents, you can also disable DTD validation altogether at session or instance level.

  • XML Generated using given DTD

    hi guys ,
    i have to make a java GUI application to generate an xml file.
    to accomplish this the code must:
    1...... ask the user to input the path of the DTD file according to which the xml file will be generated.
    2........then it should parse the DTD file and present the different element names in a tree to the user .
    3.......the user can now click on the element names one by one. Upon clicking a message box the user will be asked for value, type etc
    4.......all these values inputed by the user will be used to generate the xml file.
    my question is that ....does java have inbuilt classes to carry out DTD related manipulation.??...like for example parsing the DTD and putting the element names in a tree.
    Also how do pass on the element names to the dynamically created tree.
    i am presently using a DTD parser that i got from http://www.wutka.com.
    but not sure whether it can do the things i need .

    Well, I've just realized that JDK 1.5 has standard way to validate XMLs using XSD schemas. Ok. But look at the sample
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:import namespace="http://www.w3.org/XML/1998/namespace"
            schemaLocation="http://www.w3.org/2001/xml.xsd" />
      <xs:element name="birthdate">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="month" type="xs:string" />
            <xs:element name="day" type="xs:int" />
            <xs:element name="year" type="xs:int" />
          </xs:sequence> 
        </xs:complexType>
      </xs:element>
    </xs:schema>Every time I process this schema, it goes to w3c.org... And I wonder if it cause some problems if I delete
      <xs:import namespace="http://www.w3.org/XML/1998/namespace"
            schemaLocation="http://www.w3.org/2001/xml.xsd" />

  • On my keyboard, a few of my keys are using incorrect letters or symbols, but when I replaced the keyboard that did;t fix it.

    On my keyboard, a few of my keys are using incorrect letters or symbols, but when I replaced the keyboard that did;t fix it. Help.

    The the box check in System Preferences - Keyboard - Use F1, F2 ......... if so uncheck the box.

  • How we write into properties file using get class method

    Hi
    I want to set some value into properties file using given code
    can any one please tell me how i can do this.
    property file
    setting.properties
    Name     =     abc
    and code I use is
    java.io.InputStream oInputStream = this.getClass().getResourceAsStream("Setting.properties");
                   Properties obj = new Properties();
                   obj.load(oInputStream);
                   String myName = obj.getProperty("Name");
                   System.out.println("myName :"+myName);
                   obj.setProperty("Name","def");
                   FileOutputStream oOutput= new FileOutputStream("Setting.properties");
                   obj.store(oOutput, "");
    thanks.

    You can't.
    If you have properties that change dynamically, you should not be using a properties file that sits in the classpath, you should be using Preferences, or a properties file that sits in some application or possibly even user directory, but not one in the classpath. The proper way to do this, would be to have a properties file in your jar (or otherwise in your classpath) that contains the defaults, and another one outside of the classpath in one of the twwo above mentioned areas, then, you read the default one only if the other doesn't exist, or you read the default one first, then read the other overwriting the values from the defaults.
    Don't forget to save the properties again (right after loading if you loaded, or always load, the defaults) after every change.

  • How  to read Component profile.properties without using CAF?

    Do you know how to read DC WebDynpro Component profile.properties without using CAF.
    A Component.profile.properties is located under
    Scr/components/fullcomponentname/
    Thanks, Best regards
    Peter

    import com.sap.tc.webdynpro.services.sal.config.api.IWDConfiguration
    import com.sap.tc.webdynpro.services.sal.config.api.WDConfiguration;
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDDeployableObject;
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDDeployableObjectPart;
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDDeployableObjectPartType;
    WDDeployableObjectPart myComponent = WDDeployableObject.getDeployableObjectPart
      "mycompany.com/myapp~mydc" // name of DC
      "com.mycompany.myapp.mydc.MyComponent" // full component name
      WDDeployableObjectPartype.COMPONENT
    IWDConfiguration config = WDConfiguration.getConfigurationByName
      myComponent
      "profile.properties" // not sure, try "profile" as well
    Exception handling ommited.
    Hope this helps. Just wondering what's for?
    Valery Silaev
    P.S. full disclosure: CAF developer, author of PropertyConfigurable components concept

  • How to update bean properties when using an immediate link

    Hello,
    I have a page with a find link next to an input text field. The input text field requires a valid code to be entered. If the user doesn't know the code they need to press the find link to go to a search page and select the code. The input text code field needs to have a value entered so it has its required attribute set because the validator I have and attached to the input text field does not get called unless something is entered in the field. If I don't set the link to immediate the required constraint prevents the search page from being invoked but if I do set it to immediate the values typed on the page are not updated to the bean properties they are bound to.
    I have read many posts but I fail to see a way to resolve this. The update model phase is apparently skipped because of the immediate attribute and so the values typed in by the user are lost.
    Please help.
    Thanks,
    Randall

    A UIInput holds the submitted value.
    When updating models it is cleared to null but when some error occurs it keeps to hold the submitted value.
    The TextRenderer uses the submitted value if the value is null.
    Therefore, you can see the submitted value is redrawn when some error occurs.
    Unfortunately, this mechanizm does not work beyond requests
    because the default application action listener always create a new viewroot based on the navigation rules.
    An general solution of your problem is not so easy.
    I think it may be to customize the action listener or the lifecycle.
    A temporal solution may be that the link action copys the submitted value to the managed-beans.

  • XML Validation using custom DTD file

    Well, I thought that my problem is about to be a trivial one, but now, I don't think so. I have to develop XML-based protocol over HTTP. XML Document doesn't contain any reference to DTD, but I have some DTDs. I want to validate my XML messages in real time and I want to find some library that allows to do something like that:
    SomeXmlValidatingParser s = new SomeXmlValidatingParser(InputStream dtdFileStream);
    for(;;)
        InputStream is = message.recive();
        DocumentObject = s.parseAndValidate(is);
    }So, the issue is to pass my custom DTD file (it is already loaded to memory) into validating parser.
    So, which library have such functionality? And if there are some, could you be so kind to advice some of them?

    Well, I've just realized that JDK 1.5 has standard way to validate XMLs using XSD schemas. Ok. But look at the sample
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:import namespace="http://www.w3.org/XML/1998/namespace"
            schemaLocation="http://www.w3.org/2001/xml.xsd" />
      <xs:element name="birthdate">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="month" type="xs:string" />
            <xs:element name="day" type="xs:int" />
            <xs:element name="year" type="xs:int" />
          </xs:sequence> 
        </xs:complexType>
      </xs:element>
    </xs:schema>Every time I process this schema, it goes to w3c.org... And I wonder if it cause some problems if I delete
      <xs:import namespace="http://www.w3.org/XML/1998/namespace"
            schemaLocation="http://www.w3.org/2001/xml.xsd" />

  • Keys in GeneratorText.properties not used !!!

    hi all,
    I found in GeneratorText.properties some keys ignored and are not used in the generation process like: NOT_NULL_VIOLATION, CHECK_CONSTRAINT_VIOLATION
    How can I generate these keys in the *.properties files to translate error messages?
    yours,
    Bassam

    Bassam,
    The CHECK_CONSTRAINT_VIOLATION and NOT_NULL_VIOLATION are a left over from older JHeadstart version that also supported TopLink,and are no longer used.
    To get user-friendly error message for your check constraints, just make sure they are included in the entity object XML.
    Not null violations can easily be handle inside ADF Business Components by making an attribute required.
    Steven Davelaar,
    JHeadstart Team.

  • BPC Properties and Use

    I'm currently at a client and the situation they have is that for the ENTITY dimension, they have various numerical fees .  There are close to 10-15 fees and thus I've created 10-15 Properties for each fee.  The fee's will be standard across all categories and time, hence no need to store it as an account as that would be would require maintenance as I assume I would have to copy it across Time and Categories, whereas through properties, once its added there is no need to change it.    
    The goal is through Script logic to use the Property/Fee attributed to the Entity and perform calculations.  In BPC is it possible to write Script Logic that could call the property and then perform a calculation?  I assume I would have to create each of the fees as properties and make them "InAPP" in order to perform calcs?
    Thanks,
    Pras

    I may not be following your question so pardon if I don't actually fully answer.  When you maintain a dimension member sheet, with members and properties in the microsoft version, you may leave more data in the sheet than is stored in the dimnesion.  But only the PROPERTIES that are defined in the Manitain dimension properties will be stored in the application, with the exception of FORMULAH# entries.  In addition, in the SQL table there are other properties that are stored as part of the processing that may referenced using EVPRO, such as LEVEL. 
    Some of the unlisted properties are part of the code for the product and will be part of the table in the background, but ONLY the properties that generally are added may be used by logic or the cube based on the INAPP setting.
    Hope this helps.

  • Some of friend used incorrect id in app store and it couldn't change it .....it uneditable

    some of friend who used my macbook tried to use App Store and typed incorrect apple id...after that i tried to update the app but couldn't edit the apple id ...its unedited and i couldn't update apps

    App Store products can only be updated by signing in to the store with the same Apple ID that was originally used to download them. You can't update anything, including your own purchases, as long as there are pending updates linked to the other ID.
    If you can't sign in with the other ID, you have to delete all the apps that are linked to it. If you don't know which apps those are, see below.
    1. Triple-click anywhere in the line of text below on this page to select it:
    kMDItemAppStoreHasReceipt=1
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    2. In the Finder, press command-F to open a search window, or select
              File ▹ Find
    from the menu bar. In the search window, select
              Search: This Mac
    from the row of tokens below the toolbar. Below that is a popup menu of search criteria, initially showing Kind. From that menu, select
              Other...
    A sheet will drop down. In that sheet, select
              Raw Query
    as the criterion, then click OK or press return.
    Now there will be a text box to the right of the menu of search criteria. That's where you enter the raw search query. Click in that box and paste the text you copied earlier by pressing command-V.
    3. The search window will now show all the App Store products that are installed. Compare those search results with the list of your purchases from the App Store. To see the complete list, you may need to unhide hidden purchases. If any apps were download from the App Store using other Apple ID accounts that you control, sign in to the store under each of those ID's and check the purchases.
    4. At least one of the apps in the Spotlight search results is not among your purchases in the App Store. Delete each such item by following the instructions in the Apple Support article linked above.
    5. Quit and relaunch the App Store.
    If you find these instructions confusing, ask for an alternative method.

  • CS6 new HTML 5 document uses XHTML DTD - WTF?

    We are suffering some serious weirdness.
    I am on Win7 with CS6 and my colleague is on OSX with CS6.
    We both do file, new, blank page, none, doctype html5
    I get a correct basic html5 page, he gets the XHTML DTD & extra stuff.
    We both have fresh installs, WTF is going on?

    I'm thinking a bad install or maybe bad permissions prevented some files from being installed. You could try re-creating the configuration folder: http://helpx.adobe.com/dreamweaver/kb/troubleshoot-javascript-errors-dreamweaver-cs4.html# main_user_config .  Another thing to consider is if you are using the same version of DW.  Just because you both have CS6 does not mean you are using the same version and the difference could be causing the error or an unknown bug.  The two versions out there are the traditional boxed/download license where you own the product and can buy upgrades and the other is the Cloud license which is operating on a different version.

  • Java.util.properties ? Using Config.getProperty

    Hi all,
    This one has been causing me a bit of a headache! I am using the Java.util.properties to create a file which looks like this:
    #Tue Sep 13 19:15:06 GMT+02:00 2002
    User=tristan
    Password=bristol
    Name=Tristan\ Webb
    Rights=Tristan\ Webb
    #Tue Sep 13 19:15:35 GMT+02:00 2002
    User=adam
    Password=newcastle
    Name=Adam\ Jones
    Rights=Adam\ Jones
    The problem comes when I try to read the information back and put it in a Vector. Using the code below, it only ever puts the last users details (i.e. adam, Newcastle etc..) into the file and skips the first one. I have tried adding more users details, but it only ever reads the last entry. Is there anyway of forcing the config.getProperty to read the first entry in the file and then all the subsequesnt user details ?? I am thinking there must be a way of looping through the file, but im not sure where to start and am quite lost!
    Many Thanks,
    Properties config;
    FileInputStream file;
    file = new FileInputStream("password.cfg");
    config = new Properties();
    config.load(file);
    User2 = config.getProperty("User");
    Password = config.getProperty("Password");
    name = config.getProperty("Name");
    rights = config.getProperty("Rights");
    UserDetails user = new UserDetails(User2, Password, name, rights);
    userDetails.add(user);

    The java.util.Properties class works like a dictionary: it stores values, which you can access using the keys.
    The keys must be unique. In your case, the keys are not unique. If you do: String s = config.getProperty("User"); then how do you expect to get two values back (tristan and adam)?
    You must make the keys unique in some way. For example, write your properties file like this:
    #Tue Sep 13 19:15:06 GMT+02:00 2002
    User.1=tristan
    Password=.1bristol
    Name.1=Tristan\ Webb
    Rights.1=Tristan\ Webb
    #Tue Sep 13 19:15:35 GMT+02:00 2002
    User.2=adam
    Password.2=newcastle
    Name.2=Adam\ Jones
    Rights.2=Adam\ Jones
    Now use for example: String s = config.getProperty("User.1"); to get the name of the first user, etc.
    Jesper

Maybe you are looking for