idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
25,500
void walkMap ( final Element elem , final KeyScope scope , final List < ResolveTask > res ) { List < KeyScope > ss = Collections . singletonList ( scope ) ; if ( elem . getAttributeNode ( ATTRIBUTE_NAME_KEYSCOPE ) != null ) { ss = new ArrayList < > ( ) ; for ( final String keyscope : elem . getAttribute ( ATTRIBUTE_NAM...
Recursively walk map and process topics that have keyrefs .
25,501
private ResolveTask processTopic ( final FileInfo f , final KeyScope scope , final boolean isResourceOnly ) { final int increment = isResourceOnly ? 0 : 1 ; final Integer used = usage . containsKey ( f . uri ) ? usage . get ( f . uri ) + increment : increment ; usage . put ( f . uri , used ) ; if ( used > 1 ) { final U...
Determine how topic is processed for key reference processing .
25,502
private void processFile ( final ResolveTask r ) { final List < XMLFilter > filters = new ArrayList < > ( ) ; final ConkeyrefFilter conkeyrefFilter = new ConkeyrefFilter ( ) ; conkeyrefFilter . setLogger ( logger ) ; conkeyrefFilter . setJob ( job ) ; conkeyrefFilter . setKeyDefinitions ( r . scope ) ; conkeyrefFilter ...
Process key references in a topic . Topic is stored with a new name if it s been processed before .
25,503
private void writeKeyDefinition ( final Map < String , KeyDef > keydefs ) { try { KeyDef . writeKeydef ( new File ( job . tempDir , KEYDEF_LIST_FILE ) , keydefs . values ( ) ) ; } catch ( final DITAOTException e ) { logger . error ( "Failed to write key definition file: " + e . getMessage ( ) , e ) ; } }
Add key definition to job configuration
25,504
public synchronized Map < String , Argument > getPluginArguments ( ) { if ( PLUGIN_ARGUMENTS == null ) { final List < Element > params = toList ( Plugins . getPluginConfiguration ( ) . getElementsByTagName ( "param" ) ) ; PLUGIN_ARGUMENTS = params . stream ( ) . map ( ArgumentParser :: getArgument ) . collect ( Collect...
Lazy load parameters
25,505
private Map < String , Object > handleArgDefine ( final String arg , final Deque < String > args ) { final Map . Entry < String , String > entry = parse ( arg . substring ( 2 ) , args ) ; if ( entry . getValue ( ) == null ) { throw new BuildException ( "Missing value for property " + entry . getKey ( ) ) ; } if ( RESER...
Handler - D argument
25,506
private void handleArgInput ( final String arg , final Deque < String > args , final Argument argument ) { final Map . Entry < String , String > entry = parse ( arg , args ) ; if ( entry . getValue ( ) == null ) { throw new BuildException ( "Missing value for input " + entry . getKey ( ) ) ; } inputs . add ( argument ....
Handler input argument
25,507
private Map < String , Object > handleParameterArg ( final String arg , final Deque < String > args , final Argument argument ) { final Map . Entry < String , String > entry = parse ( arg , args ) ; if ( entry . getValue ( ) == null ) { throw new BuildException ( "Missing value for property " + entry . getKey ( ) ) ; }...
Handler parameter argument
25,508
private String getArgumentName ( final String arg ) { int pos = arg . indexOf ( "=" ) ; if ( pos == - 1 ) { pos = arg . indexOf ( ":" ) ; } return arg . substring ( 0 , pos != - 1 ? pos : arg . length ( ) ) ; }
Get argument name
25,509
public void setCurrentFile ( final URI currentFile ) { assert currentFile . isAbsolute ( ) ; super . setCurrentFile ( currentFile ) ; currentDir = currentFile . resolve ( "." ) ; }
Set current file absolute path
25,510
private void parseAttribute ( final Attributes atts ) { final URI attrValue = toURI ( atts . getValue ( ATTRIBUTE_NAME_HREF ) ) ; if ( attrValue == null ) { return ; } final String attrScope = atts . getValue ( ATTRIBUTE_NAME_SCOPE ) ; if ( isExternal ( attrValue , attrScope ) ) { return ; } String attrFormat = atts . ...
Parse the href attribute for needed information .
25,511
private void processParseResult ( final URI currentFile ) { for ( final Reference file : listFilter . getNonCopytoResult ( ) ) { categorizeReferenceFile ( file ) ; updateUplevels ( file . filename ) ; } for ( final Map . Entry < URI , URI > e : listFilter . getCopytoMap ( ) . entrySet ( ) ) { final URI source = e . get...
Process results from parsing a single topic or map
25,512
private void categorizeReferenceFile ( final Reference file ) { if ( listFilter . getCoderefTargets ( ) . contains ( file . filename ) ) { return ; } if ( isFormatDita ( file . format ) && listFilter . isDitaTopic ( ) && ! job . crawlTopics ( ) && ! listFilter . getConrefTargets ( ) . contains ( file . filename ) ) { r...
Categorize file .
25,513
private String getLevelsPath ( final URI rootTemp ) { final int u = rootTemp . toString ( ) . split ( URI_SEPARATOR ) . length - 1 ; if ( u == 0 ) { return "" ; } final StringBuilder buff = new StringBuilder ( ) ; for ( int current = u ; current > 0 ; current -- ) { buff . append ( ".." ) . append ( File . separator ) ...
Get up - levels absolute path .
25,514
private Map < URI , URI > filterConflictingCopyTo ( final Map < URI , URI > copyTo , final Collection < FileInfo > fileInfos ) { final Set < URI > fileinfoTargets = fileInfos . stream ( ) . filter ( fi -> fi . src . equals ( fi . result ) ) . map ( fi -> fi . result ) . collect ( Collectors . toSet ( ) ) ; return copyT...
Filter copy - to where target is used directly .
25,515
private void writeListFile ( final File inputfile , final String relativeRootFile ) { try ( Writer bufferedWriter = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( inputfile ) ) ) ) { bufferedWriter . write ( relativeRootFile ) ; bufferedWriter . flush ( ) ; } catch ( final IOException e ) { logger...
Write list file .
25,516
private String getPrefix ( final File relativeRootFile ) { String res ; final File p = relativeRootFile . getParentFile ( ) ; if ( p != null ) { res = p . toString ( ) + File . separator ; } else { res = "" ; } return res ; }
Prefix path .
25,517
private Map < URI , Set < URI > > addMapFilePrefix ( final Map < URI , Set < URI > > map ) { final Map < URI , Set < URI > > res = new HashMap < > ( ) ; for ( final Map . Entry < URI , Set < URI > > e : map . entrySet ( ) ) { final URI key = e . getKey ( ) ; final Set < URI > newSet = new HashSet < > ( e . getValue ( )...
Convert absolute paths to relative temporary directory paths
25,518
private Map < URI , URI > addFilePrefix ( final Map < URI , URI > set ) { final Map < URI , URI > newSet = new HashMap < > ( ) ; for ( final Map . Entry < URI , URI > file : set . entrySet ( ) ) { final URI key = tempFileNameScheme . generateTempFileName ( file . getKey ( ) ) ; final URI value = tempFileNameScheme . ge...
Add file prefix . For absolute paths the prefix is not added .
25,519
private void addFlagImagesSetToProperties ( final Job prop , final Set < URI > set ) { final Set < URI > newSet = new LinkedHashSet < > ( 128 ) ; for ( final URI file : set ) { if ( file . isAbsolute ( ) ) { newSet . add ( file . normalize ( ) ) ; } else { newSet . add ( file . normalize ( ) ) ; } } final String fileKe...
add FlagImangesSet to Properties which needn t to change the dir level just ouput to the ouput dir .
25,520
XMLReader getXmlReader ( final String format ) throws SAXException { if ( format == null || format . equals ( ATTR_FORMAT_VALUE_DITA ) ) { return reader ; } for ( final Map . Entry < String , String > e : parserMap . entrySet ( ) ) { if ( format . equals ( e . getKey ( ) ) ) { try { final XMLReader r = ( XMLReader ) Cl...
Get reader for input format
25,521
void initXmlReader ( ) throws SAXException { if ( parserMap . containsKey ( ATTR_FORMAT_VALUE_DITA ) ) { reader = XMLReaderFactory . createXMLReader ( parserMap . get ( ATTR_FORMAT_VALUE_DITA ) ) ; final Map < String , Boolean > features = parserFeatures . getOrDefault ( ATTR_FORMAT_VALUE_DITA , emptyMap ( ) ) ; for ( ...
XML reader used for pipeline parsing DITA documents .
25,522
private Element migrate ( Element root ) { if ( root . getAttributeNode ( PLUGIN_VERSION_ATTR ) == null ) { final List < Element > features = toList ( root . getElementsByTagName ( FEATURE_ELEM ) ) ; final String version = features . stream ( ) . filter ( elem -> elem . getAttribute ( FEATURE_ID_ATTR ) . equals ( "pack...
Migrate from deprecated plugin format to new format
25,523
private void addExtensionPoint ( final Element elem ) { final String id = elem . getAttribute ( EXTENSION_POINT_ID_ATTR ) ; if ( id == null ) { throw new IllegalArgumentException ( EXTENSION_POINT_ID_ATTR + " attribute not set on extension-point" ) ; } final String name = elem . getAttribute ( EXTENSION_POINT_NAME_ATTR...
Add extension point .
25,524
private void domToSax ( final Node root ) throws SAXException { try { final Result result = new SAXResult ( new FilterHandler ( getContentHandler ( ) ) ) ; final NodeList children = root . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { final Node links = rewriteLinks ( ( Element ) childre...
DOM to SAX conversion methods
25,525
private void onStartElement ( QName name , XMLAttributes atts ) { if ( detecting ) { detecting = false ; loadDefaults ( ) ; } if ( defaults != null ) { checkAndAddDefaults ( name , atts ) ; } }
On start element
25,526
private boolean nullOrValue ( String test , String value ) { if ( test == null ) return true ; if ( test . equals ( value ) ) return true ; return false ; }
Test if a string is either null or equal to a certain value
25,527
private String getFromPIDataPseudoAttribute ( String data , String name , boolean unescapeValue ) { int pos = 0 ; while ( pos <= data . length ( ) - 4 ) { int nextQuote = - 1 ; for ( int q = pos ; q < data . length ( ) ; q ++ ) { if ( data . charAt ( q ) == '"' || data . charAt ( q ) == '\'' ) { nextQuote = q ; break ;...
This method is copied from com . icl . saxon . ProcInstParser and used in the PIFinder .
25,528
private String unescape ( String value ) { if ( value . indexOf ( '&' ) < 0 ) { return value ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; if ( c == '&' ) { if ( i + 2 < value . length ( ) && value . charAt ( i + 1 ) == '#' ) { if ( va...
This method is copied from com . icl . saxon . ProcInstParser and used in the PIFinder
25,529
public void setProperty ( String propertyId , Object value ) throws XMLConfigurationException { if ( propertyId . startsWith ( Constants . XERCES_PROPERTY_PREFIX ) ) { final int suffixLength = propertyId . length ( ) - Constants . XERCES_PROPERTY_PREFIX . length ( ) ; if ( suffixLength == Constants . SYMBOL_TABLE_PROPE...
Sets the value of a property during parsing .
25,530
public void write ( final File filename ) throws DITAOTException { assert filename . isAbsolute ( ) ; super . write ( new File ( currentFile ) ) ; }
Process key references .
25,531
private void writeAlt ( Element srcElem ) throws SAXException { final AttributesImpl atts = new AttributesImpl ( ) ; XMLUtils . addOrSetAttribute ( atts , ATTRIBUTE_NAME_CLASS , TOPIC_ALT . toString ( ) ) ; getContentHandler ( ) . startElement ( NULL_NS_URI , TOPIC_ALT . localName , TOPIC_ALT . localName , atts ) ; dom...
Write alt element
25,532
private boolean fallbackToNavtitleOrHref ( final Element elem ) { final String hrefValue = elem . getAttribute ( ATTRIBUTE_NAME_HREF ) ; final String locktitleValue = elem . getAttribute ( ATTRIBUTE_NAME_LOCKTITLE ) ; return ( ( ATTRIBUTE_NAME_LOCKTITLE_VALUE_YES . equals ( locktitleValue ) ) || ( "" . equals ( hrefVal...
Return true when keyref text resolution should use navtitle as a final fallback .
25,533
private void domToSax ( final Element elem , final boolean retainElements , final boolean swapMapClass ) throws SAXException { if ( retainElements ) { final AttributesImpl atts = new AttributesImpl ( ) ; final NamedNodeMap attrs = elem . getAttributes ( ) ; for ( int i = 0 ; i < attrs . getLength ( ) ; i ++ ) { final A...
Serialize DOM node into a SAX stream .
25,534
private String changeclassValue ( final String classValue ) { final DitaClass cls = new DitaClass ( classValue ) ; if ( cls . equals ( MAP_LINKTEXT ) ) { return TOPIC_LINKTEXT . toString ( ) ; } else if ( cls . equals ( MAP_SEARCHTITLE ) ) { return TOPIC_SEARCHTITLE . toString ( ) ; } else if ( cls . equals ( MAP_SHORT...
Change map type to topic type .
25,535
private static URI normalizeHrefValue ( final URI keyName , final String tail ) { if ( keyName . getFragment ( ) == null ) { return toURI ( keyName + tail . replaceAll ( SLASH , SHARP ) ) ; } return toURI ( keyName + tail ) ; }
change elementId into topicId if there is no topicId in key definition .
25,536
private static URI normalizeHrefValue ( final URI fileName , final String tail , final String topicId ) { if ( fileName . getFragment ( ) == null && ! "" . equals ( tail ) ) { return setFragment ( fileName , topicId + tail ) ; } return toURI ( fileName + tail ) ; }
Insert topic id into href
25,537
private Range getRange ( final URI uri ) { int start = 0 ; int end = Integer . MAX_VALUE ; String startId = null ; String endId = null ; final String fragment = uri . getFragment ( ) ; if ( fragment != null ) { final Matcher m = Pattern . compile ( "^line=(?:(\\d+)|(\\d+)?,(\\d+)?)$" ) . matcher ( fragment ) ; if ( m ....
Factory method for Range implementation
25,538
private Charset getCharset ( final String value ) { Charset c = null ; if ( value != null ) { final String [ ] tokens = value . trim ( ) . split ( "[;=]" ) ; if ( tokens . length >= 3 && tokens [ 1 ] . trim ( ) . equals ( "charset" ) ) { try { c = Charset . forName ( tokens [ 2 ] . trim ( ) ) ; } catch ( final RuntimeE...
Get code file charset .
25,539
public boolean needExclude ( final Attributes atts , final QName [ ] [ ] extProps ) { if ( filterMap . isEmpty ( ) ) { return false ; } for ( final QName attr : filterAttributes ) { final String value = atts . getValue ( attr . getNamespaceURI ( ) , attr . getLocalPart ( ) ) ; if ( value != null ) { final Map < QName ,...
Check if the given Attributes need to be excluded .
25,540
private String getLabelValue ( final QName propName , final String attrPropsValue ) { if ( attrPropsValue != null ) { int propStart = - 1 ; if ( attrPropsValue . startsWith ( propName + "(" ) || attrPropsValue . contains ( " " + propName + "(" ) ) { propStart = attrPropsValue . indexOf ( propName + "(" ) ; } if ( propS...
Get labelled props value .
25,541
private void checkRuleMapping ( final QName attName , final List < String > attValue ) { if ( attValue == null || attValue . isEmpty ( ) ) { return ; } for ( final String attSubValue : attValue ) { final FilterKey filterKey = new FilterKey ( attName , attSubValue ) ; final Action filterAction = filterMap . get ( filter...
Check if attribute value has mapping in filter configuration and throw messages .
25,542
private FilterUtils refine ( final Map < QName , Map < String , Set < Element > > > bindingMap ) { if ( bindingMap != null && ! bindingMap . isEmpty ( ) ) { final Map < FilterKey , Action > buf = new HashMap < > ( filterMap ) ; for ( final Map . Entry < FilterKey , Action > e : filterMap . entrySet ( ) ) { refineAction...
Refine filter with subject scheme .
25,543
public static boolean isFormatDita ( final String attrFormat ) { if ( attrFormat == null || attrFormat . equals ( ATTR_FORMAT_VALUE_DITA ) ) { return true ; } for ( final String f : ditaFormat ) { if ( f . equals ( attrFormat ) ) { return true ; } } return false ; }
Check if format is DITA topic .
25,544
public void buildFinished ( final BuildEvent event ) { final Throwable error = event . getException ( ) ; final StringBuilder message = new StringBuilder ( ) ; if ( error == null ) { } else { message . append ( "Error: " ) ; throwableMessage ( message , error , Project . MSG_VERBOSE <= msgOutputLevel ) ; } final String...
Prints whether the build succeeded or failed any errors the occurred during the build and how long the build took .
25,545
public void targetStarted ( final BuildEvent event ) { if ( Project . MSG_INFO <= msgOutputLevel && ! event . getTarget ( ) . getName ( ) . equals ( "" ) ) { final String msg = StringUtils . LINE_SEP + event . getTarget ( ) . getName ( ) + ":" ; printMessage ( msg , out , event . getPriority ( ) ) ; log ( msg ) ; } }
Logs a message to say that the target has started if this logger allows information - level messages .
25,546
public void messageLogged ( final BuildEvent event ) { final int priority = event . getPriority ( ) ; if ( priority <= msgOutputLevel ) { final StringBuilder message = new StringBuilder ( ) ; if ( event . getTask ( ) != null && ! emacsMode ) { final String name = event . getTask ( ) . getTaskName ( ) ; String label = "...
Logs a message if the priority is suitable . In non - emacs mode task level messages are prefixed by the task name which is right - justified .
25,547
private void printMessage ( final String message , final PrintStream stream , final int priority ) { if ( useColor && priority == Project . MSG_ERR ) { stream . print ( ANSI_RED ) ; stream . print ( message ) ; stream . println ( ANSI_RESET ) ; } else { stream . println ( message ) ; } }
Prints a message to a PrintStream .
25,548
protected String getTimestamp ( ) { final Date date = new Date ( System . currentTimeMillis ( ) ) ; final DateFormat formatter = DateFormat . getDateTimeInstance ( DateFormat . SHORT , DateFormat . SHORT ) ; return formatter . format ( date ) ; }
Get the current time .
25,549
protected String extractProjectName ( final BuildEvent event ) { final Project project = event . getProject ( ) ; return ( project != null ) ? project . getName ( ) : null ; }
Get the project name or null
25,550
public void setup ( final Map < URI , URI > conflictTable ) { for ( final Map . Entry < URI , URI > e : changeTable . entrySet ( ) ) { assert e . getKey ( ) . isAbsolute ( ) ; assert e . getValue ( ) . isAbsolute ( ) ; } this . conflictTable = conflictTable ; }
Set up class .
25,551
private boolean isLocalDita ( final Attributes atts ) { final String classValue = atts . getValue ( ATTRIBUTE_NAME_CLASS ) ; if ( classValue == null || ( TOPIC_IMAGE . matches ( classValue ) ) ) { return false ; } String scopeValue = atts . getValue ( ATTRIBUTE_NAME_SCOPE ) ; if ( scopeValue == null ) { scopeValue = AT...
Check whether the attributes contains references
25,552
private String getElementID ( final String relativePath ) { final String fragment = getFragment ( relativePath ) ; if ( fragment != null ) { if ( fragment . lastIndexOf ( SLASH ) != - 1 ) { return fragment . substring ( fragment . lastIndexOf ( SLASH ) + 1 ) ; } else { return fragment ; } } return null ; }
Retrieve the element ID from the path . If there is no element ID return topic ID .
25,553
public static DITAOTCollator getInstance ( final Locale locale ) { if ( locale == null ) { throw new NullPointerException ( "Locale may not be null" ) ; } DITAOTCollator instance ; instance = cache . computeIfAbsent ( locale , DITAOTCollator :: new ) ; return instance ; }
Return the DITAOTCollator instance specifying Locale .
25,554
public int compare ( final Object source , final Object target ) { try { return ( Integer ) compareMethod . invoke ( collatorInstance , source , target ) ; } catch ( final Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } }
Comparing method required to compare .
25,555
public IndexPreprocessResult process ( final Document theInput ) throws ProcessException { final DocumentBuilder documentBuilder = XMLUtils . getDocumentBuilder ( ) ; final Document doc = documentBuilder . newDocument ( ) ; final Node rootElement = theInput . getDocumentElement ( ) ; final ArrayList < IndexEntry > inde...
Process index terms .
25,556
private Node [ ] processCurrNode ( final Node theNode , final Document theTargetDocument , final IndexEntryFoundListener theIndexEntryFoundListener ) { final NodeList childNodes = theNode . getChildNodes ( ) ; if ( checkElementName ( theNode ) && ! excludedDraftSection . peek ( ) ) { return processIndexNode ( theNode ,...
Processes curr node . Copies node to the target document if its is not a text node of index entry element . Otherwise it process it and creates nodes with prefix in given namespace_url from the parsed index entry text .
25,557
private boolean checkElementName ( final Node node ) { return TOPIC_INDEXTERM . matches ( node ) || INDEXING_D_INDEX_SORT_AS . matches ( node ) || INDEXING_D_INDEX_SEE . matches ( node ) || INDEXING_D_INDEX_SEE_ALSO . matches ( node ) ; }
Check if node is an index term element or specialization of one .
25,558
private Node [ ] processIndexString ( final String theIndexString , final List < Node > contents , final Document theTargetDocument , final IndexEntryFoundListener theIndexEntryFoundListener ) { final IndexEntry [ ] indexEntries = IndexStringProcessor . processIndexString ( theIndexString , contents ) ; for ( final Ind...
Processes index string and creates nodes with prefix in given namespace_url from the parsed index entry text .
25,559
private Element createElement ( final Document theTargetDocument , final String theName ) { final Element indexEntryNode = theTargetDocument . createElementNS ( this . namespace_url , theName ) ; indexEntryNode . setPrefix ( this . prefix ) ; return indexEntryNode ; }
Creates element with prefix in namespace_url with given name for the target document
25,560
public Set < URI > getNonTopicrefReferenceSet ( ) { final Set < URI > res = new HashSet < > ( nonTopicrefReferenceSet ) ; res . removeAll ( normalProcessingRoleSet ) ; res . removeAll ( resourceOnlySet ) ; return res ; }
List of files referenced by something other than topicref
25,561
public Set < Reference > getNonCopytoResult ( ) { final Set < Reference > nonCopytoSet = new LinkedHashSet < > ( 128 ) ; nonCopytoSet . addAll ( nonConrefCopytoTargets ) ; for ( final URI f : conrefTargets ) { nonCopytoSet . add ( new Reference ( stripFragment ( f ) , currentFileFormat ( ) ) ) ; } for ( final URI f : c...
Get all targets except copy - to .
25,562
public Set < URI > getNonConrefCopytoTargets ( ) { final Set < URI > res = new HashSet < > ( nonConrefCopytoTargets . size ( ) ) ; for ( final Reference r : nonConrefCopytoTargets ) { res . add ( r . filename ) ; } return res ; }
Get non - conref and non - copyto targets .
25,563
public static boolean canFollow ( URI href ) { if ( href != null && href . getScheme ( ) != null && href . getScheme ( ) . equals ( "mailto" ) ) { return false ; } return true ; }
Make educated guess in advance whether URI can be resolved to a file .
25,564
private boolean isOutFile ( final URI toCheckPath ) { final String path = toCheckPath . getPath ( ) ; return ! ( path != null && path . startsWith ( rootDir . getPath ( ) ) ) ; }
Check if path walks up in parent directories
25,565
public void generate ( final File fileName ) { final File outputFile = removeTemplatePrefix ( fileName ) ; templateFile = fileName ; try ( final InputStream in = new BufferedInputStream ( new FileInputStream ( fileName ) ) ; final OutputStream out = new BufferedOutputStream ( new FileOutputStream ( outputFile ) ) ) { f...
Generator the output file .
25,566
public void update ( InputSource in ) throws SAXException { defaultValuesCollector = null ; PropertyMapBuilder builder = new PropertyMapBuilder ( ) ; builder . put ( ValidateProperty . RESOLVER , resolver ) ; builder . put ( ValidateProperty . ERROR_HANDLER , eh ) ; PropertyMap properties = builder . toPropertyMap ( ) ...
Updates the annotation model .
25,567
public List < Attribute > getDefaultAttributes ( String localName , String namespace ) { if ( defaultValuesCollector != null ) { return defaultValuesCollector . getDefaultAttributes ( localName , namespace ) ; } return null ; }
Get the default attributes for an element .
25,568
private void handleID ( final AttributesImpl atts ) { String idValue = atts . getValue ( ATTRIBUTE_NAME_ID ) ; if ( idValue != null ) { XMLUtils . addOrSetAttribute ( atts , ATTRIBUTE_NAME_OID , idValue ) ; final URI value = setFragment ( dirPath . toURI ( ) . resolve ( toURI ( filePath ) ) , idValue ) ; if ( util . fi...
Get new value for topic id attribute .
25,569
private URI handleLocalDita ( final URI href , final AttributesImpl atts ) { final URI attValue = href ; final int sharpIndex = attValue . toString ( ) . indexOf ( SHARP ) ; URI pathFromMap ; URI retAttValue ; if ( sharpIndex != - 1 ) { if ( sharpIndex == 0 ) { pathFromMap = toURI ( filePath ) ; } else { pathFromMap = ...
Rewrite local DITA href value .
25,570
public void parse ( final String filename , final File dir ) { filePath = stripFragment ( filename ) ; dirPath = dir ; try { final File f = new File ( dir , filePath ) ; reader . setErrorHandler ( new DITAOTXMLErrorHandler ( f . getAbsolutePath ( ) , logger ) ) ; logger . info ( "Processing " + f . getAbsolutePath ( ) ...
Parse the file to update id .
25,571
private void handleHref ( final String classValue , final AttributesImpl atts ) { final URI attValue = toURI ( atts . getValue ( ATTRIBUTE_NAME_HREF ) ) ; if ( attValue != null ) { final String scopeValue = atts . getValue ( ATTRIBUTE_NAME_SCOPE ) ; if ( ( scopeValue == null || ATTR_SCOPE_VALUE_LOCAL . equals ( scopeVa...
Rewrite href attribute .
25,572
private URI handleLocalHref ( final URI attValue ) { final URI current = new File ( dirPath , filePath ) . toURI ( ) . normalize ( ) ; final URI reference = current . resolve ( attValue ) ; final URI merge = output . toURI ( ) ; return getRelativePath ( merge , reference ) ; }
Rewrite local non - DITA href value .
25,573
public static void start ( final String [ ] args , final Properties additionalUserProperties , final ClassLoader coreLoader ) { final Main m = new Main ( ) ; m . startAnt ( args , additionalUserProperties , coreLoader ) ; }
Creates a new instance of this class using the arguments specified gives it any extra user properties which have been specified and then runs the build using the classloader provided .
25,574
private void handleLogfile ( ) { if ( args . logFile != null ) { FileUtils . close ( out ) ; FileUtils . close ( err ) ; } }
Close logfiles if we have been writing to them .
25,575
protected void addBuildListeners ( final Project project ) { project . addBuildListener ( createLogger ( ) ) ; final int count = args . listeners . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final String className = args . listeners . elementAt ( i ) ; final BuildListener listener = ClasspathUtils . newInstance ...
Adds the listeners specified in the command line arguments along with the default listener to the specified project .
25,576
private void addInputHandler ( final Project project ) throws BuildException { final InputHandler handler ; if ( args . inputHandlerClassname == null ) { handler = new DefaultInputHandler ( ) ; } else { handler = ClasspathUtils . newInstance ( args . inputHandlerClassname , Main . class . getClassLoader ( ) , InputHand...
Creates the InputHandler and adds it to the project .
25,577
private BuildLogger createLogger ( ) { BuildLogger logger ; if ( args . loggerClassname != null ) { try { logger = ClasspathUtils . newInstance ( args . loggerClassname , Main . class . getClassLoader ( ) , BuildLogger . class ) ; } catch ( final BuildException e ) { printErrorMessage ( "The specified logger class " + ...
Creates the default build logger for sending build events to the ant log .
25,578
private void configureSaxonExtensions ( SaxonTransformerFactory tfi ) { final net . sf . saxon . Configuration conf = tfi . getConfiguration ( ) ; for ( ExtensionFunctionDefinition def : ServiceLoader . load ( ExtensionFunctionDefinition . class ) ) { try { conf . registerExtensionFunction ( def . getClass ( ) . newIns...
Registers Saxon full integrated function definitions . The intgrated function should be an instance of net . sf . saxon . lib . ExtensionFunctionDefinition abstract class .
25,579
public static void writeKeydef ( final File keydefFile , final Collection < KeyDef > keydefs ) throws DITAOTException { XMLStreamWriter keydef = null ; try ( OutputStream out = new FileOutputStream ( keydefFile ) ) { keydef = XMLOutputFactory . newInstance ( ) . createXMLStreamWriter ( out , "UTF-8" ) ; keydef . writeS...
Write key definition XML configuration file
25,580
private List < Element > getTopicrefs ( final Element root ) { final List < Element > res = new ArrayList < > ( ) ; final NodeList all = root . getElementsByTagName ( "*" ) ; for ( int i = 0 ; i < all . getLength ( ) ; i ++ ) { final Element elem = ( Element ) all . item ( i ) ; if ( MAP_TOPICREF . matches ( elem ) && ...
Get all topicrefs
25,581
private void generateCopies ( final Element topicref , final List < FilterUtils > filters ) { final List < FilterUtils > fs = combineFilterUtils ( topicref , filters ) ; final String copyTo = topicref . getAttribute ( BRANCH_COPY_TO ) ; if ( ! copyTo . isEmpty ( ) ) { final URI dstUri = map . resolve ( copyTo ) ; final...
Copy and filter topics for branches . These topics have a new name and will be added to job configuration .
25,582
private void filterTopics ( final Element topicref , final List < FilterUtils > filters ) { final List < FilterUtils > fs = combineFilterUtils ( topicref , filters ) ; final String href = topicref . getAttribute ( ATTRIBUTE_NAME_HREF ) ; final Attr skipFilter = topicref . getAttributeNode ( SKIP_FILTER ) ; final URI sr...
Modify and filter topics for branches . These files use an existing file name .
25,583
private FilterUtils getFilterUtils ( final Element ditavalRef ) { if ( ditavalRef . getAttribute ( ATTRIBUTE_NAME_HREF ) . isEmpty ( ) ) { return null ; } final URI href = toURI ( ditavalRef . getAttribute ( ATTRIBUTE_NAME_HREF ) ) ; final URI tmp = currentFile . resolve ( href ) ; final FileInfo fi = job . getFileInfo...
Read and cache filter .
25,584
private void handleKeysAttr ( final Attributes atts ) { final String attrValue = atts . getValue ( ATTRIBUTE_NAME_KEYS ) ; if ( attrValue != null ) { URI target = toURI ( atts . getValue ( ATTRIBUTE_NAME_HREF ) ) ; final URI copyTo = toURI ( atts . getValue ( ATTRIBUTE_NAME_COPY_TO ) ) ; if ( copyTo != null ) { target ...
Parse the keys attributes .
25,585
private List < String > getKeysList ( final String key , final Map < String , String > keysRefMap ) { final List < String > list = new ArrayList < > ( ) ; for ( Entry < String , String > entry : keysRefMap . entrySet ( ) ) { if ( entry . getValue ( ) . equals ( key ) ) { final String entryKey = entry . getKey ( ) ; lis...
Get multi - level keys list
25,586
private void checkMultiLevelKeys ( final Map < String , KeyDef > keysDefMap , final Map < String , String > keysRefMap ) { String key ; KeyDef value ; final Map < String , KeyDef > tempMap = new HashMap < > ( ) ; for ( Entry < String , KeyDef > entry : keysDefMap . entrySet ( ) ) { key = entry . getKey ( ) ; value = en...
Update keysDefMap for multi - level keys
25,587
public void setValidateMap ( final Map < QName , Map < String , Set < String > > > validateMap ) { this . validateMap = validateMap ; }
Set valid attribute values .
25,588
private void validateAttributeValues ( final String qName , final Attributes atts ) { if ( validateMap . isEmpty ( ) ) { return ; } for ( int i = 0 ; i < atts . getLength ( ) ; i ++ ) { final QName attrName = new QName ( atts . getURI ( i ) , atts . getLocalName ( i ) ) ; final Map < String , Set < String > > valueMap ...
Validate attribute values
25,589
private void validateAttributeGeneralization ( final Attributes atts ) { final QName [ ] [ ] d = domains . peekFirst ( ) ; if ( d != null ) { for ( final QName [ ] spec : d ) { for ( int i = spec . length - 1 ; i > - 1 ; i -- ) { if ( atts . getValue ( spec [ i ] . getNamespaceURI ( ) , spec [ i ] . getLocalPart ( ) ) ...
Validate attribute generalization . A single element may not contain both generalized and specialized values for the same attribute .
25,590
public String addId ( final URI id ) { if ( id == null ) { return null ; } final URI localId = id . normalize ( ) ; index ++ ; final String newId = PREFIX + Integer . toString ( index ) ; idMap . put ( localId , newId ) ; return newId ; }
Add topic id to the idMap .
25,591
public void addId ( final URI id , final String value ) { if ( id != null && value != null ) { final URI localId = id . normalize ( ) ; final String localValue = value . trim ( ) ; idMap . put ( localId , localValue ) ; } }
Add topic id - value pairs to idMap .
25,592
public String getIdValue ( final URI id ) { if ( id == null ) { return null ; } final URI localId = id . normalize ( ) ; return idMap . get ( localId ) ; }
Return the value corresponding to the id .
25,593
public boolean isVisited ( final URI path ) { final URI localPath = stripFragment ( path ) . normalize ( ) ; return visitSet . contains ( localPath ) ; }
Return if this path has been visited before .
25,594
public void visit ( final URI path ) { final URI localPath = stripFragment ( path ) . normalize ( ) ; visitSet . add ( localPath ) ; }
Add topic to set of visited topics .
25,595
public String getFirstTopicId ( final URI file , final boolean useCatalog ) { assert file . isAbsolute ( ) ; if ( ! ( new File ( file ) . exists ( ) ) ) { return null ; } final StringBuilder firstTopicId = new StringBuilder ( ) ; final TopicIdParser parser = new TopicIdParser ( firstTopicId ) ; try { final XMLReader re...
Get the first topic id .
25,596
private boolean checkMatch ( ) { if ( matchList == null ) { return true ; } final int matchSize = matchList . size ( ) ; final int ancestorSize = topicIdList . size ( ) ; final List < String > tail = topicIdList . subList ( ancestorSize - matchSize , ancestorSize ) ; return matchList . equals ( tail ) ; }
check whether the hierarchy of current node match the matchList
25,597
private void writeStartElement ( final String qName , final Attributes atts ) throws IOException { final int attsLen = atts . getLength ( ) ; output . write ( LESS_THAN + qName ) ; for ( int i = 0 ; i < attsLen ; i ++ ) { final String attQName = atts . getQName ( i ) ; final String attValue = escapeXML ( atts . getValu...
SAX serializer methods
25,598
private String readExtensions ( final String featureName ) { final Set < String > exts = new HashSet < > ( ) ; if ( featureTable . containsKey ( featureName ) ) { for ( final Value ext : featureTable . get ( featureName ) ) { final String e = ext . value . trim ( ) ; if ( e . length ( ) != 0 ) { exts . add ( e ) ; } } ...
Read plug - in feature .
25,599
private boolean loadPlugin ( final String plugin ) { if ( checkPlugin ( plugin ) ) { final Features pluginFeatures = pluginTable . get ( plugin ) ; final Map < String , List < String > > featureSet = pluginFeatures . getAllFeatures ( ) ; for ( final Map . Entry < String , List < String > > currentFeature : featureSet ....
Load the plug - ins and aggregate them by feature and fill into feature table .